package com.infoview.db;

import java.sql.Connection;
import java.sql.SQLException;

public class DbUtil {
	/*  private static String driverName = DbConfig.getDriverName();  //加载JDBC驱动
	  private static String dbURL = DbConfig.getUrl();  //连接服务器和数据库
	  private static String userName = DbConfig.getUserName();  //默认用户名
	  private static String userPwd = DbConfig.getPassword();  //密码
	  
*/	  
	
	  private static String driverName="com.microsoft.jdbc.sqlserver.SQLServerDriver";
      private static String dbURL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=unicom";
      private static String userName="unicom";
      private static String userPwd="123456";
	
	 /*private static String driverName="com.mysql.jdbc.Driver";
	   private static String dbURL="jdbc:mysql://localhost:3306/unicom?useUnicode=true&amp;characterEncoding=gb2312";
	   private static String userName="root";
	   private static String userPwd="root";*/
    	  
	  private static Connection dbConn;
	  
	  public DbUtil() {
		  
	  }
	
	  public static Connection getConnection() {
			try {
				Class.forName(driverName);
				dbConn = java.sql.DriverManager.getConnection(dbURL, userName, userPwd);
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
			}catch (SQLException e) {
				e.printStackTrace();
			}
			return dbConn;
	  }
}
